<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>编辑管理员</title>
    <!--字体图标-->
    <link href="http://cdn.javaex.cn/javaex/pc/css/icomoon.css" rel="stylesheet" />
    <!--动画-->
    <link href="http://cdn.javaex.cn/javaex/pc/css/animate.css" rel="stylesheet" />
    <!--骨架样式-->
    <link href="http://cdn.javaex.cn/javaex/pc/css/common.css" rel="stylesheet" />
    <!--皮肤（缇娜）-->
    <link href="http://cdn.javaex.cn/javaex/pc/css/skin/tina.css" rel="stylesheet" />
    <!--jquery，不可修改版本-->
    <script src="http://cdn.javaex.cn/javaex/pc/lib/jquery-1.7.2.min.js"></script>
    <!--全局动态修改-->
    <script src="http://cdn.javaex.cn/javaex/pc/js/common.js"></script>
    <!--核心组件-->
    <script src="http://cdn.javaex.cn/javaex/pc/js/javaex.min.js"></script>
    <!--表单验证-->
    <script src="http://cdn.javaex.cn/javaex/pc/js/javaex-formVerify.js"></script>
</head>
<style>
    body{background-color: #fff;}
    .login-form{background: #fff;margin:40px;}
    .login-title{font-size: 20px;text-align: center;margin-bottom: 25px;}
    .login-item{display: flex;margin-bottom: 14px;}
    .login-link{margin-bottom: 14px;}
    .login-link label, .login-link a{color: #9B9B9C;}
    .login-link a{font-size: 14px;}
    .login-text{min-height: 40px;width: 100%;color: #B3B3B3;font-size: 14px;border: 1px solid #EEEFF0;border-radius: 3px;font-family: Helvetica, "microsoft yahei", sans-serif;padding-left: 16px;outline: none;}
    .button.login{background-color: #16499c;color: white;width: 100%;border-radius: 3px;font-size: 14px;height: 40px;line-height: 40px;}
    .login-link .line{display: inline-block;width: 1px;height: 12px;background-color: #EEEEEE;margin: 0 6px;}
</style>
<body>
<!--登录-->
<div class="login-form">
    <form id="form">
        <input type="hidden" name="aid" th:value="${session.user.aid}">
        <!--标题-->
        <div class="login-title">编辑</div>
        <!--用户名-->
        <div class="login-item">
            <input type="text" class="login-text" name="aname" data-type="必填" placeholder="管理员" th:value="${session.user.aname}" />
        </div>
        <!--密码-->
        <div class="login-item">
            <input type="text" class="login-text" name="apass" data-type="必填"  placeholder="******"/>
        </div>
        <div class="login-item">
            <input type="text" class="login-text" name="aacount" data-type="必填" placeholder="昵称" th:value="${session.user.aacount}"/>
        </div>
        <div class="login-item">
            <input type="text" class="login-text" name="aphone" data-type="必填" placeholder="手机号码" th:value="${session.user.aphone}"/>
        </div>
        <div class="login-item">
            <input type="text" class="login-text" name="adesc" data-type="必填" placeholder="自我描述" th:value="${session.user.adesc}"/>
        </div>
        <div class="login-item">
            <input type="file" id="myfile"  class="login-text" name="headimage" data-type="必填" placeholder="头像" />
        </div>
        <!--登录按钮-->
        <div class="login-item">
            <input type="button" id="submit" class="button login" value="编辑" />
        </div>
    <!--    <#&#45;&#45;        &lt;!&ndash;底部链接&ndash;&gt;&ndash;&gt;
        <#&#45;&#45;        <div class="login-link">&ndash;&gt;
        <#&#45;&#45;            <label zoom="0.9"><input type="checkbox" class="fill" checked/>下次自动登录</label>&ndash;&gt;

        <#&#45;&#45;            <span style="float: right;">&ndash;&gt;
        <#&#45;&#45;					<a href="#" target="_blank">忘记密码</a>&ndash;&gt;
        <#&#45;&#45;					<span class="line"></span>&ndash;&gt;
        <#&#45;&#45;					<a href="javascript:;" onclick="showDiv1()">注册</a>&ndash;&gt;
        <#&#45;&#45;				</span>&ndash;&gt;
        <#&#45;&#45;        </div>&ndash;&gt;-->
    </form>
</div>
</body>
<script>
    // 监听点击保存按钮事件
    $("#submit").click(function() {
        // 表单验证函数
        if (javaexVerify()) {
            // 返回错误信息时，可以添加自定义异常提示。参数为元素id和提示
            // addErrorMsg("username", "用户名不存在");
            // 提交
            //$("#form").submit();
            var myform = new FormData();
            var headimage = $("#myfile")[0].files[0];
            myform.append("headimage", headimage);
            myform.append("aid", $("input[name='aid']").val());
            myform.append("aname", $("input[name='aname']").val());
            myform.append("apass", $("input[name='apass']").val());
            myform.append("aacount", $("input[name='aacount']").val());
            myform.append("adesc", $("input[name='adesc']").val());
            myform.append("aphone", $("input[name='aphone']").val());
            $.ajax({
                url:"adminfinedit",
                processData: false,
                contentType: false,
                data: myform,
                type: "post",
                success:function(result){
                    if(result == '0000'){

                        alert("添加成功！");
                        parent.javaex.close();

                        // 刷新页面
                        parent.location.reload();

                    } else if(result == '0001'){
                        alert("添加失败");
                    }
                }
            });




        } else {
            return false;
        }
    });
</script>
</html>